home *** CD-ROM | disk | FTP | other *** search
/ Champak 50 / Volume 50 - JOGO DISK .iso / Games / moonstonemadness.swf / scripts / __Packages / ExplodableObstacle.as < prev    next >
Encoding:
Text File  |  2007-09-27  |  857 b   |  39 lines

  1. class ExplodableObstacle extends SideScroller.StaticObject
  2. {
  3.    var mcRef;
  4.    function ExplodableObstacle(__mcRef, __oLayer)
  5.    {
  6.       super(__mcRef,__oLayer);
  7.       this.setState("Idle");
  8.    }
  9.    function onHit(__oRef)
  10.    {
  11.       if(this.CurrentState == "Idle")
  12.       {
  13.          TakGround(__oRef).doReactCollision();
  14.          this.ParentLayer.doAddListener(this);
  15.          this.setState("Explode");
  16.          this.doLockState();
  17.       }
  18.    }
  19.    function doDestroy()
  20.    {
  21.       this.ParentLayer.doRemoveListener(this);
  22.       super.doDestroy();
  23.    }
  24.    function doExplode()
  25.    {
  26.       if(this.isStateComplete())
  27.       {
  28.          if(!this.mcRef.bStateAfterExplosion)
  29.          {
  30.             this.doDestroy();
  31.          }
  32.          else
  33.          {
  34.             this.doForcedSetState("ExplodedIdle");
  35.          }
  36.       }
  37.    }
  38. }
  39.